//
//  MovieModel.m
//  UI 作业 - 豆瓣电影
//
//  Created by hesiyao on 15/12/22.
//  Copyright © 2015年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "MovieModel.h"

@implementation MovieModel

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"images"]) {
        self.image = value[@"large"];
    }
}

-(void)encodeWithCoder:(NSCoder *)aCoder
{
    [aCoder encodeObject:_title forKey:@"标题"];
    [aCoder encodeObject:_image forKey:@"图片"];
    [aCoder encodeObject:_rating forKey:@"评分"];
    [aCoder encodeObject:_pubdate forKey:@"日期"];
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super init];
    if (self) {
        self.title = [coder decodeObjectForKey:@"标题"];
        self.image = [coder decodeObjectForKey:@"图片"];
        self.rating = [coder decodeObjectForKey:@"评分"];
        self.pubdate = [coder decodeObjectForKey:@"日期"];
    }
    return self;
}
@end
